<!DOCTYPE HTML>
<html>
    <head>
        <link rel="Stylesheet" type="text/css" href="/static/css/typo.css">
        <link rel="Stylesheet" type="text/css" href="/static/css/reset_typo.css">
        <link rel="Stylesheet" type="text/css" href="/static/css/tango.css">
        <link rel="Stylesheet" type="text/css" href="/static/css/style.css">
	<link href="/static/images/favicon.ico" mce_href="/static/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <title>vim - thornbird的个人wiki</title>
        <meta name="keywords" content=""/>
        <meta name="description" content=""/>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.js"></script>
<script language="javascript" type="text/javascript">
    var oddClick = true;
    $(document).ready(function() {
      $('#toggle-button').click(function() {
        $('#container').animate({
          width: oddClick? "100%":"60%",
        });
        $(this).text(oddClick? "窄版":"宽版");
        oddClick = !oddClick;
      });
    });
</script>

    </head>

    <body>
        <div id="container" class="typo">
            
    <div id="header">
        <div id="post-nav">
            <div id="toggle-button">宽版</div>
            
            <a href="/">Home</a> » <a href="/#编辑器">编辑器</a> » vim
            
        </div>
    </div>
    <div class="clearfix"></div>
    <div id="content">
        <h4 id="normal">快捷键(Normal模式下)</h4>
<ul>
<li><code>0</code> 数字零到行头</li>
<li><code>$</code> 到本行行尾</li>
<li><code>^</code> 到本行第一个不是blank的字符的位置</li>
<li><code>g_</code> 到本行最后一个不是blank的字符的位置</li>
<li><code>r</code> 替换光标所在处的字符一次</li>
<li><code>R</code> 持续替换光标所在处的字符，直到按下ESC</li>
<li><code>*</code> 向后查找当前光标所在的单词</li>
<li><code>#</code> 向前查找当前光标所在的单词</li>
<li><code>shift+i</code> 在行首插入</li>
<li><code>shift+a</code> 在行尾插入</li>
<li><code>vim -o file1 file2</code> 小写的字母o，两文件上下分屏展示</li>
<li><code>vim -O file1 file2</code> 大写的字母O，两文件左右分屏展示</li>
<li><code>:sp</code> Normal模式下,将当前文件上下分屏展示</li>
<li><code>:vsp</code> Normal模式下,将当前文件上下分屏展示</li>
<li><code>:Ex</code> 打开目录结构</li>
</ul>
<h4 id="_1">快捷键(插入模式下)</h4>
<ul>
<li><code>Ctrl+y</code> 复制上一行光标所在的字符</li>
</ul>
<h4 id="_2">插件</h4>
<ul>
<li><a href="https://github.com/Raimondi/delimitMate.git">delimitMate</a> 成对符号补齐</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=2548">php-doc</a> php_doc</li>
</ul>
<div class="hlcode"><pre><span class="nb">source</span> <span class="err">~</span><span class="p">/</span><span class="nx">php</span><span class="na">-doc.vim</span>
<span class="nx">inoremap</span> <span class="o">&lt;</span><span class="nx">C</span><span class="na">-L</span><span class="o">&gt;</span> <span class="o">&lt;</span><span class="nx">ESC</span><span class="o">&gt;</span><span class="p">:</span><span class="nb">call</span> <span class="nx">PhpDocSingle</span><span class="p">()</span><span class="o">&lt;</span><span class="nx">CR</span><span class="o">&gt;</span>
<span class="nx">nnoremap</span> <span class="o">&lt;</span><span class="nx">C</span><span class="na">-L</span><span class="o">&gt;</span> <span class="p">:</span><span class="nb">call</span> <span class="nx">PhpDocSingle</span><span class="p">()</span><span class="o">&lt;</span><span class="nx">CR</span><span class="o">&gt;</span>
<span class="nx">vnoremap</span> <span class="o">&lt;</span><span class="nx">C</span><span class="na">-L</span><span class="o">&gt;</span> <span class="p">:</span><span class="nb">call</span> <span class="nx">PhpDocRange</span><span class="p">()</span><span class="o">&lt;</span><span class="nx">CR</span><span class="o">&gt;</span>
</pre></div>


<h4 id="_3">配置</h4>
<ul>
<li><code>noremap &lt;F4&gt; &lt;Esc&gt;:append &lt;CR&gt;error_log(print_r($&lt;c-r&gt;=expand("&lt;cword&gt;")&lt;CR&gt;,true)."\n", 3, '/home/dev/log.log');&lt;CR&gt;.&lt;CR&gt;:w&lt;CR&gt;</code>  配置error_log的快捷代码段</li>
<li><a href="https://github.com/amix/vimrc">amix</a> Vimrc配置</li>
</ul>
<h4 id="linux">配合linux系统的用法</h4>
<ul>
<li><code>Ctrl+z</code> Normal模式下放到后端</li>
<li><code>jobs</code> 查看后端运行的进程</li>
<li><code>fg n</code> 选择后台运行的进程的编号，可以通过这个打开之前vim打开的文件</li>
</ul>
    </div>

        </div>
        <div id="footer">
              <p>
                Copyright © 2012-2016 thornbird.
                Powered by <a href="http://simiki.org/" target="_blank">Simiki</a>.
                Theme by <a href="https://github.com/tankywoo/yasimple" target="_blank">YASimple</a>.
              </p>
                <p>Last Update 2016-07-28 17:00:33</p>
        </div>
    </body>
</html>